package org.jackysoft.entity;

import java.util.Calendar;

import javax.persistence.MappedSuperclass;
import javax.persistence.OneToOne;

import org.apache.struts2.json.annotations.JSON;
import org.hibernate.annotations.Type;
import org.jackysoft.entity.AbstractEntity;
import org.jackysoft.entity.User;
import org.jackysoft.util.NoSerialize;
import org.jackysoft.util.SecurityGrade;
import org.joda.time.DateTime;


@MappedSuperclass
public class FileItem extends AbstractEntity{
	/**
	 * 
	 */
	private static final long serialVersionUID = 8369294962124146711L;
	/**主键*/

	protected  String title;
	protected  String diskBase;
	protected  String realName;
	protected  String imgpath;
	protected  long size;		
	protected  String description;
	protected  String deleteFlag;
	protected  DateTime createTime;	
	protected  User  owner;
	protected  Boolean shared;
    protected  String fileType;
	private String openUrl;
    private String saveUrl;    

	private  SecurityGrade  securityGrade  = SecurityGrade.内部; 
    
	public FileItem(){
    
    }
	
    public FileItem(String id,String title,String fileType){
    	this.id = id;
    	this.title = title;
    	this.fileType = fileType;
    }
    public FileItem(String title,String diskBase,String realName,String fileType){
    	this.realName = realName;
    	this.title = title;
    	this.diskBase = diskBase;    	
    	this.fileType = fileType;
    }
	
    public FileItem(String realName){
		this.realName = realName;
	}
    
	public String getImgpath() {
		return imgpath;
	}


	public void setImgpath(String imgpath) {
		this.imgpath = imgpath;
	}


	public String getDescription() {
		return description;
	}


	public void setDescription(String description) {
		this.description = description;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@NoSerialize
	@JSON(serialize=false)
	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public long getSize() {
		return this.size;
	}

	public void setSize(long size) {
		this.size = size;
	}

	public String getDeleteFlag() {
		return deleteFlag;
	}

	public void setDeleteFlag(String deleteFlag) {
		this.deleteFlag = deleteFlag;
	}

    @Type(type="jodatime")
	public DateTime getCreateTime() {
		return createTime;
	}


	public void setCreateTime(DateTime createTime) {
		this.createTime = createTime;
	}


	/**
	 * @return the owner
	 */
	@OneToOne
	public User getOwner() {
		return owner;
	}


	/**
	 * @param owner the owner to set
	 */
	public void setOwner(User owner) {
		this.owner = owner;
	}


	public Boolean isShared() {
		return shared;
	}


	public void setShared(Boolean shared) {
		this.shared = shared;
	}


	public String getFileType() {
		return fileType;
	}


	public void setFileType(String fileType) {
		this.fileType = fileType;
	}

	public String getDiskBase() {
		return diskBase;
	}

	public void setDiskBase(String diskBase) {
		this.diskBase = diskBase;
	}

	public SecurityGrade getSecurityGrade() {
		return securityGrade;
	}

	public void setSecurityGrade(SecurityGrade securityGrade) {
		this.securityGrade = securityGrade;
	}
	
	public String getOpenUrl() {
		return openUrl;
	}

	public void setOpenUrl(String openUrl) {
		this.openUrl = openUrl;
	}

	public String getSaveUrl() {
		return saveUrl;
	}

	public void setSaveUrl(String saveUrl) {
		this.saveUrl = saveUrl;
	}
}